from django.db import models
from commodity.models import Commodity
from apps.user.models import User

# Create your models here.


class Order(models.Model):
    order_no = models.TextField('订单号')
    money = models.FloatField()
    subject = models.TextField('商品信息')
    status = models.SmallIntegerField(default=0) # 正常订单， 支付失败， 支付成功
    c_time = models.DateTimeField('创建时间', auto_now_add=True)
    u_time = models.DateTimeField('修改时间', auto_now=True)
    commodity = models.ForeignKey(Commodity, verbose_name='商品ID', on_delete=models.CASCADE)
    user = models.ForeignKey(User, verbose_name='用户ID', on_delete=models.CASCADE)

    class Meta:
        db_table = 'order'